/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.purpose.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.koron.purpose.domain.JobsDutiesTask;

public interface JobsDutiesTaskMapper {

	@Delete("delete from jobs_duties_task where duties_id=#{id}")
	int delete(@Param("id") String dutiesId);
	
	@Insert("<script>"
			+ "insert into jobs_duties_task(id,task_type_id,task_type_label,task_object_id,task_object_label,note,cycle_id,cycle_label,duties_id,istemplate) values"
			+ "<foreach collection ='beanList' item='item' index='index' separator =','>"
			+ "(#{item.id},#{item.taskTypeId},#{item.taskTypeLabel},#{item.taskObjectId},#{item.taskObjectLabel},#{item.note},#{item.cycleId},#{item.cycleLabel},#{item.dutiesId},#{item.istemplate}) </foreach>"
			+ "</script>")
	int batchInsert(@Param("beanList") List<JobsDutiesTask> list);
	
	@Select("select * from jobs_duties_task where duties_id=#{id}")
	List<JobsDutiesTask> queryByTid(@Param("id") String dutiesId);
	
}
